package dr.board.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dr.controller.*;
import dr.board.dao.BoardDAO;
import dr.board.domain.Board;
  
public class ContentAction extends ActionSupportLogin {//글내용 처리

    public String execute(HttpServletRequest request,
        HttpServletResponse response)throws Throwable {

		String id=getUserLoginId(request);// session
		
		//login check
		if(id==null) return LOGINULL_PATH;
		//login check
		
        int num = Integer.parseInt(request.getParameter("num"));//해당 글번호
        String pageNum = request.getParameter("pageNum");//해당 페이지 번호

        BoardDAO dbPro = BoardDAO.getInstance();//DB처리
        Board article =  dbPro.getArticle(num);//해당 글번호에 대한 해당 레코드
  
        //해당 뷰에서 사용할 속성
    	request.setAttribute("pageNum", new Integer(pageNum));
    	request.setAttribute("article", article);
        
        return "/board/content.jsp";//해당 뷰
    } 
}
